home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2006 November
/
PCWorld_2006-11_cd.bin
/
domacnost a kancelar
/
easytime
/
ETT.exe
/
reports
/
xslt
/
DetailedInvoice.xsl
next >
Wrap
Extensible Markup Language
|
2006-08-18
|
9KB
|
223 lines
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<xsl:apply-templates select="/Report/HeaderInfo"></xsl:apply-templates>
<xsl:apply-templates select="/Report/Customer"></xsl:apply-templates>
<xsl:apply-templates select="/Report/Customer/Project" mode="customer-project"/>
<xsl:apply-templates select="/Report/Customer/Tax"></xsl:apply-templates>
<xsl:apply-templates select="/Report/Customer/Total"></xsl:apply-templates>
</html>
</xsl:template>
<!-- Верхний заголовок -->
<xsl:template match="HeaderInfo">
<table class="TableSB" align="center" width="70%">
<tr>
<td>
<table class="TableSB" width="100%" cellpadding="2" cellspacing="0" >
<tr>
<td colspan="2" align="center" class="ReportTitleClass">Invoice# <xsl:value-of select="InvoiceNumber"/></td>
</tr>
<tr>
<td colspan="2" align="right" class="Date"><xsl:value-of select="CurrentDate"/></td>
</tr>
</table>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="Customer">
<table align="center" width="70%">
<tr>
<td class="DetailRowTitleClass">Bill to:</td>
</tr>
<tr>
<td class="CompanyName" colspan="2">
<xsl:value-of select="Name"/>
</td>
</tr>
</table>
<table align="center" width="70%">
<xsl:if test="Address">
<tr>
<td class="DetailRowDataClass" width="100%"><xsl:value-of select="Address"/> </td>
</tr>
</xsl:if>
<xsl:if test="Address2">
<tr>
<td class="DetailRowDataClass" width="100%"><xsl:value-of select="Address2"/> </td>
</tr>
</xsl:if>
<xsl:if test="City">
<tr>
<td class="DetailRowDataClass" width="100%"><xsl:value-of select="City"/></td>
</tr>
</xsl:if>
<xsl:if test="State">
<tr>
<td class="DetailRowDataClass" width="100%">
<xsl:value-of select="State"/>
</td>
</tr>
</xsl:if>
<xsl:if test="Country">
<tr>
<td class="DetailRowDataClass" width="100%"> <xsl:value-of select="Country"/>
</td>
</tr>
</xsl:if>
<xsl:if test="Zip">
<tr>
<td class="DetailRowDataClass" width="100%">
<xsl:value-of select="Zip"/>
</td>
</tr>
</xsl:if>
<xsl:if test="Phone">
<tr>
<td class="DetailRowDataClass" width="100%">
<xsl:value-of select="Phone"/>
</td>
</tr>
</xsl:if>
<xsl:if test="Fax">
<tr>
<td class="DetailRowDataClass" width="100%"> <xsl:value-of select="Fax"/>
</td>
</tr>
</xsl:if>
</table>
<xsl:if test="string(//Report/HeaderInfo/Terms)!=''">
<table align="center" width="70%">
<tr>
<td class="DetailRowTitleClass">Terms:</td>
<td class="DetailRowDataClass" width="100%"><xsl:value-of select="//Report/HeaderInfo/Terms"/></td>
</tr>
</table>
</xsl:if>
</xsl:template>
<xsl:template match="/Report/Customer/Project" mode="customer-project">
<xsl:if test="Date">
<table align="center" width="70%">
<tr>
<td colspan="6" class="ProjectName">Project: <span class="Pname">
<xsl:value-of select="@Name"/></span><br/>Date Range: <xsl:value-of select="//HeaderInfo/Date/From"/> - <xsl:value-of select="//HeaderInfo/Date/To"/></td>
</tr>
<!--<xsl:if test="position()=1"> -->
<tr>
<xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='yes'">
<td width="10%" class="DetailRowTitleClass">Date</td>
<td width="30%" class="DetailRowTitleClass">Task</td>
<td width="30%" class="DetailRowTitleClass">Description</td>
<td width="5%" class="DetailRowTitleClassCenter">Rate</td>
<td width="10%" class="DetailRowTitleClassCenter">Hours</td>
<td width="10%" class="DetailRowTitleClassCenter">Amount</td>
</xsl:if>
<xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='no'">
<td width="10%" class="DetailRowTitleClass">Date</td>
<td class="DetailRowTitleClass">Task</td>
<td width="10%" class="DetailRowTitleClassCenter">Rate</td>
<td width="20%" class="DetailRowTitleClassCenter">Hours</td>
<td width="20%" class="DetailRowTitleClassCenter">Amount</td>
</xsl:if>
</tr>
<!-- </xsl:if> -->
<xsl:apply-templates select="Date" mode="customer-date"/>
<xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='no'">
<tr>
<td width="70%" valign="top" class="SubTotal">Sub-total: </td>
<td valign="top" colspan="3" class="DetailRowDataClass1"><xsl:value-of select="SubTotal/@Hours"/></td>
<td valign="top" colspan="1" class="DetailRowDataClass1"><xsl:value-of select="SubTotal/@Amount"/></td>
</tr>
</xsl:if>
<xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='yes'">
<tr>
<td width="70%" valign="top" class="SubTotal">Sub-total: </td>
<td valign="top" colspan="4" class="DetailRowDataClass1"><xsl:value-of select="SubTotal/@Hours"/></td>
<td valign="top" colspan="2" class="DetailRowDataClass1"><xsl:value-of select="SubTotal/@Amount"/></td>
</tr>
</xsl:if>
</table>
</xsl:if>
</xsl:template>
<xsl:template match="Project/Date" mode="customer-date">
<tr>
<xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='yes'">
<td width="10%" class="DetailRowDataClass"><xsl:value-of select="@Value"/></td>
<td width="30%" class="DetailRowDataClass"><xsl:value-of select="Task"/></td>
<td width="30%" class="DetailRowDataClass"><xsl:value-of select="Description"/></td>
<td width="5%" class="DetailRowDataClass1"><xsl:value-of select="Rate"/></td>
<td width="10%" class="DetailRowDataClass1"><xsl:value-of select="Hours"/></td>
<td width="10%" class="DetailRowDataClass1"><xsl:value-of select="Amount"/></td>
</xsl:if>
<xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='no'">
<td width="10%" class="DetailRowDataClass"><xsl:value-of select="@Value"/></td>
<td width="100%" class="DetailRowDataClass"><xsl:value-of select="Task"/></td>
<td width="10%" class="DetailRowDataClass1"><xsl:value-of select="Rate"/></td>
<td width="20%" class="DetailRowDataClass1"><xsl:value-of select="Hours"/></td>
<td width="20%" class="DetailRowDataClass1"><xsl:value-of select="Amount"/></td>
</xsl:if>
</tr>
</xsl:template>
<xsl:template match="/Report/Customer/Tax">
<table width="70%" align="center">
<xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='no'">
<tr>
<td width="60%" class="Tax" aling="right">Tax (<xsl:value-of select="Percent"/>%)</td>
<td class="TaxText" align="right"><xsl:value-of select="Value"/></td>
</tr>
</xsl:if>
<xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='yes'">
<tr>
<td width="60%" class="Tax" align="right">Tax (<xsl:value-of select="Percent"/>%)</td>
<td class="TaxText" align="right"><xsl:value-of select="Value"/></td>
</tr>
</xsl:if>
</table>
</xsl:template>
<xsl:template match="/Report/Customer/Total">
<table width="70%" align="center">
<xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='no'">
<tr>
<td width="60%" class="Total">Total:</td>
<td class="Total"><xsl:value-of select="text()"/></td>
</tr>
</xsl:if>
<xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='yes'">
<tr>
<td width="60%" class="Total">Total:</td>
<td class="Total"><xsl:value-of select="text()"/></td>
</tr>
</xsl:if>
</table>
</xsl:template>
<xsl:template match="Companies/Company">
<xsl:value-of select="text()"/>
<xsl:if test="following-sibling::*/text()">, </xsl:if>
</xsl:template>
<xsl:template match="Projects/Project">
<xsl:value-of select="text()"/>
<xsl:if test="following-sibling::*/text()">, </xsl:if>
</xsl:template>
<xsl:template match="Tasks/Task">
<xsl:value-of select="text()"/>
<xsl:if test="following-sibling::*/text()">, </xsl:if>
</xsl:template>
</xsl:stylesheet>